home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part1 / 7022 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  1.8 KB

  1. Path: news1.cris.com!news
  2. From: aubrey@concentric.net (Aubrey Harrison)
  3. Newsgroups: comp.lang.c
  4. Subject: Re: What to do when feof() is NOT feof()
  5. Date: 17 Feb 1996 16:29:45 GMT
  6. Organization: Concentric Internet Services
  7. Message-ID: <4g4vpp$52f@spectator.cris.com>
  8. References: <824554814snz@metsys.demon.co.uk>
  9. NNTP-Posting-Host: cnc022032.concentric.net
  10. Mime-Version: 1.0
  11. Content-Type: Text/Plain; charset=US-ASCII
  12. X-Newsreader: WinVN 0.99.6
  13.  
  14.  
  15. I think if you open the file in "text" mode the end of the file is indicated by 
  16. the EOF marker (ASCII 26 I believe). To avoid this you must open the file in 
  17. binary mode. 
  18.  
  19. In article <824554814snz@metsys.demon.co.uk>, John@metsys.demon.co.uk says...
  20. >
  21. >I have a function in a program which is reading each character
  22. >in a file of some 700k characters.
  23. >
  24. >The do{ while !feof(in) sometimes causes the function to terminate
  25. >very early in the file.
  26. >
  27. >I wrote a utility to read the file and give the line number of
  28. >feof(in)......it returns ffff sometimes as early as line 200 in
  29. >a 30,000 line file.
  30. >
  31. >Any have any suggestions on the best way of coding a
  32. >
  33. >do{
  34. >
  35. >}while not the real feof(in) ignore all other feof(in)'s
  36. >
  37. >
  38. >These files get the data via radio, satellite, long distance telephone,
  39. >etc, somewhere they get the feof as a corrupt character.
  40. >
  41. >So there could be any number of EOF's in the file.
  42. >
  43. >John
  44. >-- 
  45. >Douglas John Standen
  46.  
  47. -- 
  48. =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  49. Aubrey Harrison    aubrey@concentric.net    75320.1606@compuserve.com
  50. =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  51. Loneliness is to endure the presence of one who does not understand.
  52.                                          -Elbert Hubbard (1856-1915)
  53. =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  54.  
  55.